import Vue from "vue";
import Vuex from "vuex";

import axios from "axios";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    arr: [],
  },
  getters: {},
  mutations: {},
  actions: {
    ADD(context, payload) {
      axios({
        method: "post",
        url: "/api/students/addlist",
        data: {
          content: payload,
          name: "11",
        },
        headers: {
          "content-type": "application/json",
        },
      }).then((res) => {
        // location.reload();
        console.log(res);
      });
    },
    GET_COMMIT() {
      axios.get("/api/students/getstulist").then((res) => {
        this.state.arr = res.data.data;
      });
    },
    REMOV(context, payload) {
      console.log(typeof payload);
      axios({
        method: "get",
        url: "/api/students/del",
        data: {
          id: "LzgQ31561487",
        },
      }).then((res) => console.log(res));
    },
  },
  modules: {},
});
